cmake_minimum_required(VERSION 3.10.2)
project(protobufTest)
find_package(Threads)
set(CMAKE_CXX_STANDARD 17) 
add_definitions("-Wall -g")

set(BOOST_ROOT /usr/local/include/boost)
find_package(Boost COMPONENTS filesystem REQUIRED)

file(GLOB_RECURSE utils_srcs  ../server/base/src/*.cpp)
file(GLOB_RECURSE datatime_srcs ../server/datetime/src/*.cpp)
file(GLOB_RECURSE logger_srcs ../server/logging/src/*.cpp)
file(GLOB_RECURSE thread_srcs  ../server/thread/src/*.cpp)
file(GLOB_RECURSE net_srcs  ../server/net/src/*.cpp)
file(GLOB_RECURSE rpc_srcs  ./protorpc/src/*.cpp)

add_executable(client client.cpp proto/rpcserver.pb.cc proto/rpc.pb.cc protobuf/ProtobufCodecLite.cpp ${rpc_srcs} ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs})
target_link_libraries(client protobuf z ${CMAKE_THREAD_LIBS_INIT} lua)

add_executable(balancer rpcbalancer_main.cpp rpcbalancer.cpp ./proto/rpc.pb.cc ./protobuf/ProtobufCodecLite.cpp ${rpc_srcs} ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs})
target_link_libraries(balancer protobuf z lua ${CMAKE_THREAD_LIBS_INIT})

add_executable(server server.cpp proto/rpcserver.pb.cc proto/rpc.pb.cc protobuf/ProtobufCodecLite.cpp ${rpc_srcs} ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs})
target_link_libraries(server protobuf z ${CMAKE_THREAD_LIBS_INIT} lua dl ${Boost_LIBRARIES})
